﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace TileEngine
{
    class Cloud
    {
        Vector2 Location;
        float speed;
        bool isMoveRight;
        int type;

        public Cloud()
        {
            isMoveRight = Convert.ToBoolean(Global.myRandom.Next() % 2);
            speed = (float)(Global.myRandom.Next() % 15 + 5)/100;
            type = Global.myRandom.Next() % 15;
            if (isMoveRight)
                Location = new Vector2(-500, Global.myRandom.Next() % Camera.screenDimension.Y);
            if (!isMoveRight)
                Location = new Vector2(Camera.screenDimension.X+500, Global.myRandom.Next() % Camera.screenDimension.Y);
        }
        public void update()
        {
            if (isMoveRight)
                Location.X += speed;
            else
                Location.X -= speed;
        }
        public void randomizeLocation()
        {
            Location.X = Global.myRandom.Next() % Camera.screenDimension.X;
        }
        public void draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(Textures.cloud[type], Location, Color.White);
        }
        public bool isOut()
        {
            if (Location.X < -500)
                return true;
            if (Location.X > Camera.screenDimension.X + 500)
                return true;
            return false;
        }
    }
}
